package com.controleFamiliar.pojo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="tb_categoriadespesa")
public class CategoriaDespesa implements Serializable{

	private static final long serialVersionUID = 1L;

	private Integer codCategoriaDespesa;
	private String descricao;

	public CategoriaDespesa(){}

	public CategoriaDespesa(Integer codCategoriaDespesa, String descricao) {
		super();
		this.codCategoriaDespesa = codCategoriaDespesa;
		this.descricao = descricao;
	}
	
	@Id
	@SequenceGenerator(name="categoria_sequence", initialValue=1, allocationSize=1, sequenceName="tb_categoriadespesa_codcategoriadespesa_seq")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="categoria_sequence")
	@Column(name="codcategoriadespesa", nullable=false)
	public Integer getCodCategoriaDespesa() {
		return codCategoriaDespesa;
	}

	public void setCodCategoriaDespesa(Integer codCategoriaDespesa) {
		this.codCategoriaDespesa = codCategoriaDespesa;
	}

	@Column(name="descricao", length=100, nullable=false)
	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((codCategoriaDespesa == null) ? 0 : codCategoriaDespesa
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CategoriaDespesa other = (CategoriaDespesa) obj;
		if (codCategoriaDespesa == null) {
			if (other.codCategoriaDespesa != null)
				return false;
		} else if (!codCategoriaDespesa.equals(other.codCategoriaDespesa))
			return false;
		return true;
	}
		
}
